

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>现有集群切换到 cephadm &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="Host Management" href="../host-management/" />
    <link rel="prev" title="部署个全新的 Ceph 集群" href="../install/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Cephadm</a> &raquo;</li>
        
      <li>现有集群切换到 cephadm</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephadm/adoption.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Cephadm</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../compatibility/">Compatibility and Stability</a></li>
<li class="toctree-l2"><a class="reference internal" href="../install/">部署个全新的 Ceph 集群</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">现有集群切换到 cephadm</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">局限性</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id2">准备工作</a></li>
<li class="toctree-l3"><a class="reference internal" href="#adoption-process">Adoption process</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../host-management/">Host Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../services/">Service Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../upgrade/">Ceph 的升级</a></li>
<li class="toctree-l2"><a class="reference internal" href="../operations/">Cephadm operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="../client-setup/">Client Setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="../troubleshooting/">Troubleshooting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/cephadm/">Cephadm Feature Planning</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="cephadm">
<span id="cephadm-adoption"></span><h1>现有集群切换到 cephadm<a class="headerlink" href="#cephadm" title="Permalink to this headline">¶</a></h1>
<p>把现有集群转交给 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 接管是可行的。
适用于之前用 <code class="docutils literal notranslate"><span class="pre">ceph-deploy</span></code> 、 <code class="docutils literal notranslate"><span class="pre">ceph-ansible</span></code> 、或 <code class="docutils literal notranslate"><span class="pre">DeepSea</span></code> 部署的集群。</p>
<p>这篇文档就解释了如何确定你的集群是否能转换成可以被 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 接管的状态，
以及如何执行那些转换步骤。</p>
<div class="section" id="id1">
<h2>局限性<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><p>Cephadm 仅适配 BlueStore OSDs；集群内的 FileStore OSDs 不能用 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 管理。</p></li>
</ul>
</div>
<div class="section" id="id2">
<h2>准备工作<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<ol class="arabic">
<li><p>确保 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 命令行工具可以在现有集群内的各个主机上正常使用。
如何部署请参考 <a class="reference internal" href="../install/#get-cephadm"><span class="std std-ref">安装 cephadm</span></a> 。</p></li>
<li><p>Prepare each host for use by <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> by running this command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "# ";
}
</style><span class="prompt1">cephadm prepare-host</span>
</pre></div></div></li>
<li><p>Choose a version of Ceph to use for the conversion. This procedure will work
with any release of Ceph that is Octopus (15.2.z) or later, inclusive.  The
latest stable release of Ceph is the default. You might be upgrading from an
earlier Ceph release at the same time that you’re performing this
conversion; if you are upgrading from an earlier release, make sure to
follow any upgrade-releated instructions for that release.</p>
<p>Pass the image to cephadm with the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm --image <span class="nv">$IMAGE</span> &lt;rest of <span class="nb">command</span> goes here&gt;</span>
</pre></div></div><p>The conversion begins.</p>
</li>
<li><p>Confirm that the conversion is underway by running <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">ls</span></code> and
making sure that the style of the daemons is changed:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm ls</span>
</pre></div></div><p>Before starting the converstion process, <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">ls</span></code> shows all existing
daemons to have a style of <code class="docutils literal notranslate"><span class="pre">legacy</span></code>. As the adoption process progresses,
adopted daemons will appear with a style of <code class="docutils literal notranslate"><span class="pre">cephadm:v1</span></code>.</p>
</li>
</ol>
</div>
<div class="section" id="adoption-process">
<h2>Adoption process<a class="headerlink" href="#adoption-process" title="Permalink to this headline">¶</a></h2>
<ol class="arabic">
<li><p>Make sure that the ceph configuration has been migrated to use the cluster
config database.  If the <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.conf</span></code> is identical on each host,
then the following command can be run on one single host and will affect all
hosts:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config assimilate-conf -i /etc/ceph/ceph.conf</span>
</pre></div></div><p>If there are configuration variations between hosts, you will need to repeat
this command on each host. During this adoption process, view the cluster’s
configuration to confirm that it is complete by running the following
command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config dump</span>
</pre></div></div></li>
<li><p>Adopt each monitor:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm adopt --style legacy --name mon.&lt;hostname&gt;</span>
</pre></div></div><p>Each legacy monitor should stop, quickly restart as a cephadm
container, and rejoin the quorum.</p>
</li>
<li><p>Adopt each manager:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm adopt --style legacy --name mgr.&lt;hostname&gt;</span>
</pre></div></div></li>
<li><p>Enable cephadm:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph mgr module <span class="nb">enable</span> cephadm</span>
<span class="prompt1">ceph orch <span class="nb">set</span> backend cephadm</span>
</pre></div></div></li>
<li><p>Generate an SSH key:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph cephadm generate-key</span>
<span class="prompt1">ceph cephadm get-pub-key &gt; ~/ceph.pub</span>
</pre></div></div></li>
<li><p>Install the cluster SSH key on each host in the cluster:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ssh-copy-id -f -i ~/ceph.pub root@&lt;host&gt;</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>It is also possible to import an existing ssh key. See
<a class="reference internal" href="../troubleshooting/#cephadm-ssh-errors"><span class="std std-ref">ssh errors</span></a> in the troubleshooting
document for instructions that describe how to import existing
ssh keys.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>It is also possible to have cephadm use a non-root user to ssh
into cluster hosts. This user needs to have passwordless sudo access.
Use <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">cephadm</span> <span class="pre">set-user</span> <span class="pre">&lt;user&gt;</span></code> and copy the ssh key to that user.
See <a class="reference internal" href="../host-management/#cephadm-ssh-user"><span class="std std-ref">Configuring a different SSH user</span></a></p>
</div>
</li>
<li><p>Tell cephadm which hosts to manage:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch host add &lt;hostname&gt; <span class="o">[</span>ip-address<span class="o">]</span></span>
</pre></div></div><p>This will perform a <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">check-host</span></code> on each host before adding it;
this check ensures that the host is functioning properly. The IP address
argument is recommended; if not provided, then the host name will be resolved
via DNS.</p>
</li>
<li><p>Verify that the adopted monitor and manager daemons are visible:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch ps</span>
</pre></div></div></li>
<li><p>Adopt all OSDs in the cluster:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm adopt --style legacy --name &lt;name&gt;</span>
</pre></div></div><p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm adopt --style legacy --name osd.1</span>
<span class="prompt1">cephadm adopt --style legacy --name osd.2</span>
</pre></div></div></li>
<li><p>Redeploy MDS daemons by telling cephadm how many daemons to run for
each file system. List file systems by name with the command <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">fs</span>
<span class="pre">ls</span></code>. Run the following command on the master nodes to redeploy the MDS
daemons:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch apply mds &lt;fs-name&gt; <span class="o">[</span>--placement<span class="o">=</span>&lt;placement&gt;<span class="o">]</span></span>
</pre></div></div><p>For example, in a cluster with a single file system called <cite>foo</cite>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph fs ls</span>
</pre></div></div><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>name: foo, metadata pool: foo_metadata, data pools: <span class="o">[</span>foo_data <span class="o">]</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch apply mds foo <span class="m">2</span></span>
</pre></div></div><p>Confirm that the new MDS daemons have started:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch ps --daemon-type mds</span>
</pre></div></div><p>Finally, stop and remove the legacy MDS daemons:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl stop ceph-mds.target</span>
<span class="prompt1">rm -rf /var/lib/ceph/mds/ceph-*</span>
</pre></div></div></li>
<li><p>Redeploy RGW daemons. Cephadm manages RGW daemons by zone. For each
zone, deploy new RGW daemons with cephadm:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch apply rgw &lt;svc_id&gt; <span class="o">[</span>--realm<span class="o">=</span>&lt;realm&gt;<span class="o">]</span> <span class="o">[</span>--zone<span class="o">=</span>&lt;zone&gt;<span class="o">]</span> <span class="o">[</span>--port<span class="o">=</span>&lt;port&gt;<span class="o">]</span> <span class="o">[</span>--ssl<span class="o">]</span> <span class="o">[</span>--placement<span class="o">=</span>&lt;placement&gt;<span class="o">]</span></span>
</pre></div></div><p>where <em>&lt;placement&gt;</em> can be a simple daemon count, or a list of
specific hosts (see <a class="reference internal" href="../services/#orchestrator-cli-placement-spec"><span class="std std-ref">Daemon Placement</span></a>), and the
zone and realm arguments are needed only for a multisite setup.</p>
<p>After the daemons have started and you have confirmed that they are
functioning, stop and remove the old, legacy daemons:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl stop ceph-rgw.target</span>
<span class="prompt1">rm -rf /var/lib/ceph/radosgw/ceph-*</span>
</pre></div></div></li>
<li><p>Check the output of the command <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">health</span> <span class="pre">detail</span></code> for cephadm warnings
about stray cluster daemons or hosts that are not yet managed by cephadm.</p></li>
</ol>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../host-management/" class="btn btn-neutral float-right" title="Host Management" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../install/" class="btn btn-neutral float-left" title="部署个全新的 Ceph 集群" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>